package com.bike.util;

public class TransFerUtil {
	public static Double getLatLngForLong(Long latLng){
		if(latLng==null){
			latLng=0l;
		}
		return latLng/10000000000.0;
	}
	public static Long getLatLngForDouble(Double latLng){
		if(latLng==null){
			latLng=0.0d;
		}
		return (long) (latLng*10000000000L);
	}
	
	public static String getMybatisOperation(String op,String value){
		String  result=null;
		 if(op.equals("equal")){
			 result="='"+(value);
		 }else if(op.equals("contains")){
			 result=" like '%"+value+"%";
		 }else if(op.equals("notequal")){
			 result="<>'"+value;;
		 }else if(op.equals("greater")){
			 result=">'"+value;;
		 }else if(op.equals("greaterorequal")){
			 result=">='"+value;
		 }else if(op.equals("lessorequal")){
			 result="<='"+value;;
		 }else if(op.equals("beginwith")){
			 result=" like '%"+value;
		 }else if(op.equals("endwith")){
			 result=" like '"+value+"%";
		 } else if(op.equals("less")){
			 result="<'"+value;;
		 } 
		 return result +"'";
	}
	public static String getMybatisField(String field) {
		String newField=new String(field);
		for(int i=0;i<field.length();i++){
			char str=field.charAt(i);
			if(str>='A'&&str<='Z'){
				newField=newField.replaceAll(str+"", ("_"+str).toLowerCase());
			}
		}
		return newField;
	}
	public static void main(String[] args) {
		System.out.println(getMybatisField("userName"));
	}
}
